/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License. You may obtain a copy of the License at.
 *  http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 *  either express or implied. See the License for the specific language governing permissions and limitations under the License.
 */

package com.mansoor.app.islamicnames.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.mansoor.app.islamicnames.beans.Name;
import com.mansoor.app.islamicnames.views.FavorateView;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: TKMAQ61
 * Date: Oct 21, 2009
 * Time: 3:16:16 PM
 */
public class NameAdapter extends BaseAdapter
{
     private static final String CLASSTAG = NameAdapter.class.getSimpleName();
    private final Context context;
    private final List<Name> names;

    public NameAdapter(Context context, List<Name> names)
    {
        this.context = context;
        this.names = names;
    }

    public int getCount()
    {
        return names.size();  //To change body of implemented methods use File | Settings | File Templates.
    }

    public Object getItem(int i)
    {
        return names.get(i);  //To change body of implemented methods use File | Settings | File Templates.
    }

    public long getItemId(int i)
    {
        return i;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public View getView(int i, View view, ViewGroup viewGroup)
    {
        final Name name = names.get(i);

        return new FavorateView(context,name);  //To change body of implemented methods use File | Settings | File Templates.
    }
}
